package org.example.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.example.dto.BusinessPageDto;
import org.example.mapper.BusinessMapper;
import org.example.mapper.GoodsMaterialMapper;
import org.example.result.PageResult;
import org.example.service.BusinessService;
import org.example.vo.BusinessVo;
import org.example.vo.GoodsMaterialVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 19816
* @description 针对表【sys_business】的数据库操作Service实现
* @createDate 2024-05-29 15:38:15
*/
@Service
public class BusinessServiceImpl implements BusinessService{

    @Autowired
    private BusinessMapper businessMapper;

    @Autowired
    private GoodsMaterialMapper goodsMaterialMapper;

    @Override
    public PageResult businessListAll(BusinessPageDto businessPageDto) {
        PageHelper.startPage(businessPageDto.getPageNum(),businessPageDto.getPageSize());
        Page<BusinessVo> page = businessMapper.businessListAll(businessPageDto);
        return PageResult.builder()
                .recodes(page)
                .total(page.getTotal())
                .build();
    }

    @Override
    public List<GoodsMaterialVo> materialList(String id) {
        return goodsMaterialMapper.materialList(id);
    }
}




